home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / emacs-10.z / emacs-10
Encoding:
GNU Info File  |  1994-08-02  |  48.8 KB  |  1,220 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Lisp Indent,  Next: C Indent,  Prev: Multi-line Indent,  Up: Program Indent
  6.  
  7. Customizing Lisp Indentation
  8. ----------------------------
  9.  
  10.    The indentation pattern for a Lisp expression can depend on the
  11. function called by the expression.  For each Lisp function, you can
  12. choose among several predefined patterns of indentation, or define an
  13. arbitrary one with a Lisp program.
  14.  
  15.    The standard pattern of indentation is as follows: the second line
  16. of the expression is indented under the first argument, if that is on
  17. the same line as the beginning of the expression; otherwise, the second
  18. line is indented underneath the function name.  Each following line is
  19. indented under the previous line whose nesting depth is the same.
  20.  
  21.    If the variable `lisp-indent-offset' is non-`nil', it overrides the
  22. usual indentation pattern for the second line of an expression, so that
  23. such lines are always indented `lisp-indent-offset' more columns than
  24. the containing list.
  25.  
  26.    The standard pattern is overridden for certain functions.  Functions
  27. whose names start with `def' always indent the second line by
  28. `lisp-body-indent' extra columns beyond the open-parenthesis starting
  29. the expression.
  30.  
  31.    The standard pattern can be overridden in various ways for individual
  32. functions, according to the `lisp-indent-hook' property of the function
  33. name.  There are four possibilities for this property:
  34.  
  35. `nil'
  36.      This is the same as no property; the standard indentation pattern
  37.      is used.
  38.  
  39. `defun'
  40.      The pattern used for function names that start with `def' is used
  41.      for this function also.
  42.  
  43. a number, NUMBER
  44.      The first NUMBER arguments of the function are "distinguished"
  45.      arguments; the rest are considered the "body" of the expression.
  46.      A line in the expression is indented according to whether the
  47.      first argument on it is distinguished or not.  If the argument is
  48.      part of the body, the line is indented `lisp-body-indent' more
  49.      columns than the open-parenthesis starting the containing
  50.      expression.  If the argument is distinguished and is either the
  51.      first or second argument, it is indented *twice* that many extra
  52.      columns.  If the argument is distinguished and not the first or
  53.      second argument, the standard pattern is followed for that line.
  54.  
  55. a symbol, SYMBOL
  56.      SYMBOL should be a function name; that function is called to
  57.      calculate the indentation of a line within this expression.  The
  58.      function receives two arguments:
  59.     STATE
  60.           The value returned by `parse-partial-sexp' (a Lisp primitive
  61.           for indentation and nesting computation) when it parses up to
  62.           the beginning of this line.
  63.  
  64.     POS
  65.           The position at which the line being indented begins.
  66.  
  67.      It should return either a number, which is the number of columns of
  68.      indentation for that line, or a list whose car is such a number.
  69.      The difference between returning a number and returning a list is
  70.      that a number says that all following lines at the same nesting
  71.      level should be indented just like this one; a list says that
  72.      following lines might call for different indentations.  This makes
  73.      a difference when the indentation is being computed by `C-M-q'; if
  74.      the value is a number, `C-M-q' need not recalculate indentation
  75.      for the following lines until the end of the list.
  76.  
  77. 
  78. File: emacs,  Node: C Indent,  Prev: Lisp Indent,  Up: Program Indent
  79.  
  80. Customizing C Indentation
  81. -------------------------
  82.  
  83.    Two variables control which commands perform C indentation and when.
  84.  
  85.    If `c-auto-newline' is non-`nil', newlines are inserted both before
  86. and after braces that you insert, and after colons and semicolons.
  87. Correct C indentation is done on all the lines that are made this way.
  88.  
  89.    If `c-tab-always-indent' is `nil', the TAB command in C mode does
  90. indentation only if point is at the left margin or within the line's
  91. indentation.  If there is non-whitespace to the left of point, then TAB
  92. just inserts a tab character in the buffer.  Normally, this variable is
  93. `t', and TAB always reindents the current line.  The default behavior
  94. means that to insert a real tab character you must quote it by typing
  95. `C-q' TAB.
  96.  
  97.    C does not have anything analogous to particular function names for
  98. which special forms of indentation are desirable.  However, it has a
  99. different need for customization facilities: many different styles of C
  100. indentation are in common use.
  101.  
  102.    There are six variables you can set to control the style that Emacs C
  103. mode uses.
  104.  
  105. `c-indent-level'
  106.      Indentation of C statements within surrounding block.  The
  107.      surrounding block's indentation is the indentation of the line on
  108.      which the open-brace appears.
  109.  
  110. `c-continued-statement-offset'
  111.      Extra indentation given to a substatement, such as the then-clause
  112.      of an if or body of a while.
  113.  
  114. `c-brace-offset'
  115.      Extra indentation for line if it starts with an open brace.
  116.  
  117. `c-brace-imaginary-offset'
  118.      An open brace following other text is treated as if it were this
  119.      far to the right of the start of its line.
  120.  
  121. `c-argdecl-indent'
  122.      Indentation level of declarations of C function arguments.
  123.  
  124. `c-label-offset'
  125.      Extra indentation for line that is a label, or case or default.
  126.  
  127.    The variable `c-indent-level' controls the indentation for C
  128. statements with respect to the surrounding block.  In the example
  129.  
  130.          {
  131.            foo ();
  132.  
  133. the difference in indentation between the lines is `c-indent-level'.
  134. Its standard value is 2.
  135.  
  136.    If the open-brace beginning the compound statement is not at the
  137. beginning of its line, the `c-indent-level' is added to the indentation
  138. of the line, not the column of the open-brace.  For example,
  139.  
  140.      if (losing) {
  141.        do_this ();
  142.  
  143. One popular indentation style is that which results from setting
  144. `c-indent-level' to 8 and putting open-braces at the end of a line in
  145. this way.  I prefer to put the open-brace on a separate line.
  146.  
  147.    In fact, the value of the variable `c-brace-imaginary-offset' is
  148. also added to the indentation of such a statement.  Normally this
  149. variable is zero.  Think of this variable as the imaginary position of
  150. the open brace, relative to the first nonblank character on the line.
  151. By setting this variable to 4 and `c-indent-level' to 0, you can get
  152. this style:
  153.  
  154.      if (x == y) {
  155.          do_it ();
  156.          }
  157.  
  158.    When `c-indent-level' is zero, the statements inside most braces
  159. will line up right under the open brace.  But there is an exception made
  160. for braces in column zero, such as surrounding a function's body.  The
  161. statements just inside it do not go at column zero.  Instead,
  162. `c-brace-offset' and `c-continued-statement-offset' (see below) are
  163. added to produce a typical offset between brace levels, and the
  164. statements are indented that far.
  165.  
  166.    `c-continued-statement-offset' controls the extra indentation for a
  167. line that starts within a statement (but not within parentheses or
  168. brackets).  These lines are usually statements that are within other
  169. statements, such as the then-clauses of `if' statements and the bodies
  170. of `while' statements.  This parameter is the difference in indentation
  171. between the two lines in
  172.  
  173.      if (x == y)
  174.        do_it ();
  175.  
  176. Its standard value is 2.  Some popular indentation styles correspond to
  177. a value of zero for `c-continued-statement-offset'.
  178.  
  179.    `c-brace-offset' is the extra indentation given to a line that
  180. starts with an open-brace.  Its standard value is zero; compare
  181.  
  182.      if (x == y)
  183.        {
  184.  
  185. with
  186.  
  187.      if (x == y)
  188.        do_it ();
  189.  
  190. if `c-brace-offset' were set to 4, the first example would become
  191.  
  192.      if (x == y)
  193.            {
  194.  
  195.    `c-argdecl-indent' controls the indentation of declarations of the
  196. arguments of a C function.  It is absolute: argument declarations
  197. receive exactly `c-argdecl-indent' spaces.  The standard value is 5,
  198. resulting in code like this:
  199.  
  200.      char *
  201.      index (string, c)
  202.           char *string;
  203.           int c;
  204.  
  205.    `c-label-offset' is the extra indentation given to a line that
  206. contains a label, a case statement, or a `default:' statement.  Its
  207. standard value is -2, resulting in code like this
  208.  
  209.      switch (c)
  210.        {
  211.        case 'x':
  212.  
  213. If `c-label-offset' were zero, the same code would be indented as
  214.  
  215.      switch (c)
  216.        {
  217.          case 'x':
  218.  
  219. This example assumes that the other variables above also have their
  220. standard values.
  221.  
  222.    I strongly recommend that you try out the indentation style produced
  223. by the standard settings of these variables, together with putting open
  224. braces on separate lines.  You can see how it looks in all the C source
  225. files of GNU Emacs.
  226.  
  227. 
  228. File: emacs,  Node: Matching,  Next: Comments,  Prev: Program Indent,  Up: Programs
  229.  
  230. Automatic Display Of Matching Parentheses
  231. =========================================
  232.  
  233.    The Emacs parenthesis-matching feature is designed to show
  234. automatically how parentheses match in the text.  Whenever you type a
  235. self-inserting character that is a closing delimiter, the cursor moves
  236. momentarily to the location of the matching opening delimiter, provided
  237. that is on the screen.  If it is not on the screen, some text near it is
  238. displayed in the echo area.  Either way, you can tell what grouping is
  239. being closed off.
  240.  
  241.    In Lisp, automatic matching applies only to parentheses.  In C, it
  242. applies to braces and brackets too.  Emacs knows which characters to
  243. regard as matching delimiters based on the syntax table, which is set
  244. by the major mode.  *Note Syntax::.
  245.  
  246.    If the opening delimiter and closing delimiter are mismatched--such
  247. as in `[x)'--a warning message is displayed in the echo area.  The
  248. correct matches are specified in the syntax table.
  249.  
  250.    Two variables control parenthesis match display.
  251. `blink-matching-paren' turns the feature on or off; `nil' turns it off,
  252. but the default is `t' to turn match display on.
  253. `blink-matching-paren-distance' specifies how many characters back to
  254. search to find the matching opening delimiter.  If the match is not
  255. found in that far, scanning stops, and nothing is displayed.  This is
  256. to prevent scanning for the matching delimiter from wasting lots of
  257. time when there is no match.  The default is 12,000.
  258.  
  259.    When using X Windows, you can request a more powerful kind of
  260. automatic parenthesis matching by loading the `paren' library.  To load
  261. it, type `M-x load-library RET paren RET'.  This library turns off the
  262. usual kind of matching parenthesis display and substitutes another:
  263. whenever point is after a close parenthesis, the close parenthesis and
  264. its matching open parenthesis are both highlighted; otherwise, if point
  265. is before an open parenthesis, the matching close parenthesis is
  266. highlighted.  (There is no need to highlight the open parenthesis after
  267. point because the cursor appears on top of that character.)
  268.  
  269. 
  270. File: emacs,  Node: Comments,  Next: Balanced Editing,  Prev: Matching,  Up: Programs
  271.  
  272. Manipulating Comments
  273. =====================
  274.  
  275.    The comment commands insert, kill and align comments.
  276.  
  277. `M-;'
  278.      Insert or align comment (`indent-for-comment').
  279.  
  280. `C-x ;'
  281.      Set comment column (`set-comment-column').
  282.  
  283. `C-u - C-x ;'
  284.      Kill comment on current line (`kill-comment').
  285.  
  286. `M-LFD'
  287.      Like RET followed by inserting and aligning a comment
  288.      (`indent-new-comment-line').
  289.  
  290. `M-x comment-region'
  291.      Add or remove comment delimiters on all the lines in the region.
  292.  
  293.    The command that creates a comment is `M-;' (`indent-for-comment').
  294. If there is no comment already on the line, a new comment is created,
  295. aligned at a specific column called the "comment column".  The comment
  296. is created by inserting the string Emacs thinks comments should start
  297. with (the value of `comment-start'; see below).  Point is left after
  298. that string.  If the text of the line extends past the comment column,
  299. then the indentation is done to a suitable boundary (usually, at least
  300. one space is inserted).  If the major mode has specified a string to
  301. terminate comments, that is inserted after point, to keep the syntax
  302. valid.
  303.  
  304.    `M-;' can also be used to align an existing comment.  If a line
  305. already contains the string that starts comments, then `M-;' just moves
  306. point after it and re-indents it to the conventional place.  Exception:
  307. comments starting in column 0 are not moved.
  308.  
  309.    Some major modes have special rules for indenting certain kinds of
  310. comments in certain contexts.  For example, in Lisp code, comments which
  311. start with two semicolons are indented as if they were lines of code,
  312. instead of at the comment column.  Comments which start with three
  313. semicolons are supposed to start at the left margin.  Emacs understands
  314. these conventions by indenting a double-semicolon comment using TAB,
  315. and by not changing the indentation of a triple-semicolon comment at
  316. all.
  317.  
  318.      ;; This function is just an example
  319.      ;;; Here either two or three semicolons are appropriate.
  320.      (defun foo (x)
  321.      ;;; And now, the first part of the function:
  322.        ;; The following line adds one.
  323.        (1+ x))           ; This line adds one.
  324.  
  325.    In C code, a comment preceded on its line by nothing but whitespace
  326. is indented like a line of code.
  327.  
  328.    Even when an existing comment is properly aligned, `M-;' is still
  329. useful for moving directly to the start of the comment.
  330.  
  331.    `C-u - C-x ;' (`kill-comment') kills the comment on the current line,
  332. if there is one.  The indentation before the start of the comment is
  333. killed as well.  If there does not appear to be a comment in the line,
  334. nothing is done.  To reinsert the comment on another line, move to the
  335. end of that line, do `C-y', and then do `M-;' to realign it.  Note that
  336. `C-u - C-x ;' is not a distinct key; it is `C-x ;'
  337. (`set-comment-column') with a negative argument.  That command is
  338. programmed so that when it receives a negative argument it calls
  339. `kill-comment'.  However, `kill-comment' is a valid command which you
  340. could bind directly to a key if you wanted to.
  341.  
  342.    The `M-x comment-region' command adds comment delimiters to the
  343. lines that start in the region, thus commenting them out.  With a
  344. negative argument, it does the opposite--it deletes comment delimiters
  345. from the lines in the region.
  346.  
  347.    With a positive argument, `comment-region' adds comment delimiters
  348. and duplicates the last character of the comment start sequence as many
  349. times as the argument specifies.  Thus, in Lisp mode, `C-u 2 M-x
  350. comment-region' adds `;;' to each line.
  351.  
  352.    Duplicating the comment delimiter is a way of calling attention to
  353. the comment.  It can also affect how the comment is indented.  In Lisp,
  354. for proper indentation, you should use an argument of two, if between
  355. defuns, and three, if within a defun.
  356.  
  357. Multiple Lines of Comments
  358. --------------------------
  359.  
  360.    If you are typing a comment and find that you wish to continue it on
  361. another line, you can use the command `M-LFD'
  362. (`indent-new-comment-line'), which terminates the comment you are
  363. typing, creates a new blank line afterward, and begins a new comment
  364. indented under the old one.  When Auto Fill mode is on, going past the
  365. fill column while typing a comment causes the comment to be continued in
  366. just this fashion.  If point is not at the end of the line when `M-LFD'
  367. is typed, the text on the rest of the line becomes part of the new
  368. comment line.
  369.  
  370. Options Controlling Comments
  371. ----------------------------
  372.  
  373.    The comment column is stored in the variable `comment-column'.  You
  374. can set it to a number explicitly.  Alternatively, the command `C-x ;'
  375. (`set-comment-column') sets the comment column to the column point is
  376. at.  `C-u C-x ;' sets the comment column to match the last comment
  377. before point in the buffer, and then does a `M-;' to align the current
  378. line's comment under the previous one.  Note that `C-u - C-x ;' runs
  379. the function `kill-comment' as described above.
  380.  
  381.    The variable `comment-column' is per-buffer: setting the variable in
  382. the normal fashion affects only the current buffer, but there is a
  383. default value which you can change with `setq-default'.  *Note
  384. Locals::.  Many major modes initialize this variable for the current
  385. buffer.
  386.  
  387.    The comment commands recognize comments based on the regular
  388. expression that is the value of the variable `comment-start-skip'.
  389. This regexp should not match the null string.  It may match more than
  390. the comment starting delimiter in the strictest sense of the word; for
  391. example, in C mode the value of the variable is `"/\\*+ *"', which
  392. matches extra stars and spaces after the `/*' itself.  (Note that `\\'
  393. is needed in Lisp syntax to include a `\' in the string, which is needed
  394. to deny the first star its special meaning in regexp syntax.  *Note
  395. Regexps::.)
  396.  
  397.    When a comment command makes a new comment, it inserts the value of
  398. `comment-start' to begin it.  The value of `comment-end' is inserted
  399. after point, so that it will follow the text that you will insert into
  400. the comment.  In C mode, `comment-start' has the value `"/* "' and
  401. `comment-end' has the value `" */"'.
  402.  
  403.    The variable `comment-multi-line' controls how `M-LFD'
  404. (`indent-new-comment-line') behaves when used inside a comment.  If
  405. `comment-multi-line' is `nil', as it normally is, then the comment on
  406. the starting line is terminated and a new comment is started on the new
  407. following line.  If `comment-multi-line' is not `nil', then the new
  408. following line is set up as part of the same comment that was found on
  409. the starting line.  This is done by not inserting a terminator on the
  410. old line, and not inserting a starter on the new line.  In languages
  411. where multi-line comments work, the choice of value for this variable
  412. is a matter of taste.
  413.  
  414.    The variable `comment-indent-function' should contain a function
  415. that will be called to compute the indentation for a newly inserted
  416. comment or for aligning an existing comment.  It is set differently by
  417. various major modes.  The function is called with no arguments, but with
  418. point at the beginning of the comment, or at the end of a line if a new
  419. comment is to be inserted.  It should return the column in which the
  420. comment ought to start.  For example, in Lisp mode, the indent hook
  421. function bases its decision on how many semicolons begin an existing
  422. comment, and on the code in the preceding lines.
  423.  
  424. 
  425. File: emacs,  Node: Balanced Editing,  Next: Symbol Completion,  Prev: Comments,  Up: Programs
  426.  
  427. Editing Without Unbalanced Parentheses
  428. ======================================
  429.  
  430. `M-('
  431.      Put parentheses around next sexp(s) (`insert-parentheses').
  432.  
  433. `M-)'
  434.      Move past next close parenthesis and re-indent
  435.      (`move-over-close-and-reindent').
  436.  
  437.    The commands `M-(' (`insert-parentheses') and `M-)'
  438. (`move-over-close-and-reindent') are designed to facilitate a style of
  439. editing which keeps parentheses balanced at all times.  `M-(' inserts a
  440. pair of parentheses, either together as in `()', or, if given an
  441. argument, around the next several sexps, and leaves point after the open
  442. parenthesis.  Instead of typing `( F O O )', you can type `M-( F O O',
  443. which has the same effect except for leaving the cursor before the
  444. close parenthesis.  Then you can type `M-)', which moves past the close
  445. parenthesis, deleting any indentation preceding it (in this example
  446. there is none), and indenting with LFD after it.
  447.  
  448.    `M-(' may insert a space before the open parenthesis, depending on
  449. the syntax class or the preceding character.  Set
  450. `parens-dont-require-spaces' to a non-`nil' value if you wish to
  451. inhibit this.
  452.  
  453. 
  454. File: emacs,  Node: Symbol Completion,  Next: Documentation,  Prev: Balanced Editing,  Up: Programs
  455.  
  456. Completion for Symbol Names
  457. ===========================
  458.  
  459.    Usually completion happens in the minibuffer.  But one kind of
  460. completion is available in all buffers: completion for symbol names.
  461.  
  462.    The character `M-TAB' runs a command to complete the partial symbol
  463. before point against the set of meaningful symbol names.  Any
  464. additional characters determined by the partial name are inserted at
  465. point.
  466.  
  467.    If the partial name in the buffer has more than one possible
  468. completion and they have no additional characters in common, a list of
  469. all possible completions is displayed in another window.
  470.  
  471.    There are two ways of determining the set of legitimate symbol names
  472. to complete against.  In most major modes, this uses a tag table (*note
  473. Tags::.); the legitimate symbol names are the tag names listed in the
  474. tag table file.  The command which implements this is `complete-tag'.
  475.  
  476.    In Emacs-Lisp mode, the name space for completion normally consists
  477. of nontrivial symbols present in Emacs--those that have function
  478. definitions, values or properties.  However, if there is an
  479. open-parenthesis immediately before the beginning of the partial symbol,
  480. only symbols with function definitions are considered as completions.
  481. The command which implements this is `lisp-complete-symbol'.
  482.  
  483. 
  484. File: emacs,  Node: Documentation,  Next: Change Log,  Prev: Symbol Completion,  Up: Programs
  485.  
  486. Documentation Commands
  487. ======================
  488.  
  489.    As you edit Lisp code to be run in Emacs, the commands `C-h f'
  490. (`describe-function') and `C-h v' (`describe-variable') can be used to
  491. print documentation of functions and variables that you want to call.
  492. These commands use the minibuffer to read the name of a function or
  493. variable to document, and display the documentation in a window.
  494.  
  495.    For extra convenience, these commands provide default arguments
  496. based on the code in the neighborhood of point.  `C-h f' sets the
  497. default to the function called in the innermost list containing point.
  498. `C-h v' uses the symbol name around or adjacent to point as its default.
  499.  
  500.    Documentation on Unix commands, system calls and libraries can be
  501. obtained with the `M-x manual-entry' command.  This reads a topic as an
  502. argument, and displays the text on that topic from the Unix manual.
  503. `manual-entry' starts a background process that formats the manual
  504. page, by running the `man' program.  The result goes in a buffer named
  505. `*man TOPIC*'.  These buffers have a special major mode that
  506. facilitates scrolling and examining other manual pages.
  507.  
  508.    Eventually the GNU project hopes to replace most man pages with
  509. better-organized manuals that you can browse with Info.  *Note Misc
  510. Help::.  Since this process is only partially completed, it is still
  511. useful to read manual pages.
  512.  
  513. 
  514. File: emacs,  Node: Change Log,  Next: Tags,  Prev: Documentation,  Up: Programs
  515.  
  516. Change Logs
  517. ===========
  518.  
  519.    The Emacs command `C-x 4 a' adds a new entry to the change log file
  520. for the file you are editing (`add-change-log-entry-other-window').
  521.  
  522.    A change log file contains a chronological record of when and why you
  523. have changed a program, consisting of a sequence of entries describing
  524. individual changes.  Normally it is kept in a file called `ChangeLog'
  525. in the same directory as the file you are editing, or one of its parent
  526. directories.  A single `ChangeLog' file can record changes for all the
  527. files in its directory and all its subdirectories.
  528.  
  529.    A change log entry starts with a header line that contains your name
  530. and the current date.  Aside from these header lines, every line in the
  531. change log starts with a space or a tab.  The bulk of the entry consists
  532. of "items", each of which starts with a line starting with whitespace
  533. and a star.  Here are two entries, each with two items:
  534.  
  535.      Wed May  5 14:11:45 1993  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
  536.      
  537.          * man.el: Rename functions and variables `man-*' to `Man-*'.
  538.          (manual-entry): Make prompt string clearer.
  539.      
  540.          * simple.el (blink-matching-paren-distance): Change default to 12,000.
  541.      
  542.      Tue May  4 12:42:19 1993  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
  543.      
  544.          * vc.el (minor-mode-map-alist): Don't use it if it's void.
  545.          (vc-cancel-version): Doc fix.
  546.  
  547.    One entry can describe several changes; each change should have its
  548. own item.  Normally there should be a blank line between items.  When
  549. items are related (parts of the same change, in different places), group
  550. them by leaving no blank line between them.  The second entry above
  551. contains two items grouped in this way.
  552.  
  553.    `C-x 4 a' visits the change log file and creates a new entry unless
  554. the most recent entry is for today's date and your name.  It also
  555. creates a new item for the current file.  For many languages, it can
  556. even guess the name of the function or other object that was changed.
  557.  
  558.    The change log file is visited in Change Log mode.  Each bunch of
  559. grouped items counts as one paragraph, and each entry is considered a
  560. page.  This facilitates editing the entries.  LFD and auto-fill indent
  561. each new line like the previous line; this is convenient for entering
  562. the contents of an entry.
  563.  
  564. 
  565. File: emacs,  Node: Tags,  Next: Emerge,  Prev: Change Log,  Up: Programs
  566.  
  567. Tag Tables
  568. ==========
  569.  
  570.    A "tag table" is a description of how a multi-file program is broken
  571. up into files.  It lists the names of the component files and the names
  572. and positions of the functions (or other named subunits) in each file.
  573. Grouping the related files makes it possible to search or replace
  574. through all the files with one command.  Recording the function names
  575. and positions makes possible the `M-.'  command which you can use to
  576. find the definition of a function without having to know which of the
  577. files it is in.
  578.  
  579.    Tag tables are stored in files called "tag table files".  The
  580. conventional name for a tag table file is `TAGS'.
  581.  
  582.    Each entry in the tag table records the name of one tag, the name of
  583. the file that the tag is defined in (implicitly), and the position in
  584. that file of the tag's definition.
  585.  
  586.    Just what names from the described files are recorded in the tag
  587. table depends on the programming language of the described file.  They
  588. normally include all functions and subroutines, and may also include
  589. global variables, data types, and anything else convenient.  Each name
  590. recorded is called a "tag".
  591.  
  592. * Menu:
  593.  
  594. * Tag Syntax::          Tag syntax for various types of code and text
  595.                           files.
  596. * Create Tag Table::    Creating a tag table with `etags'.
  597. * Select Tag Table::    How to visit a tag table.
  598. * Find Tag::            Commands to find the definition of a specific
  599.                           tag.
  600. * Tags Search::         Using a tag table for searching and replacing.
  601. * Tags Stepping::       Visiting files in a tag table, one by one.
  602. * List Tags::           Listing and finding tags defined in a file.
  603.  
  604. 
  605. File: emacs,  Node: Tag Syntax,  Next: Create Tag Table,  Up: Tags
  606.  
  607. Source File Tag Syntax
  608. ----------------------
  609.  
  610.    In Lisp code, any function defined with `defun', any variable
  611. defined with `defvar' or `defconst', and in general the first argument
  612. of any expression that starts with `(def' in column zero, is a tag.
  613.  
  614.    In Scheme code, tags include anything defined with `def' or with a
  615. construct whose name starts with `def'.  They also include variables
  616. set with `set!' at top level in the file.
  617.  
  618.    In C code, any C function is a tag, and so is any typedef if `-t' is
  619. specified when the tag table is constructed.
  620.  
  621.    In Yacc or Bison input files, each rule defines as a tag the
  622. nonterminal it constructs.  The portions of the file that contain C code
  623. are parsed as C code.
  624.  
  625.    In Fortran code, functions and subroutines are tags.
  626.  
  627.    In Prolog code, a tag name appears at the left margin.
  628.  
  629.    In assembler code, labels appearing at the beginning of a line,
  630. followed by a colon, are tags.
  631.  
  632.    In LaTeX text, the argument of any of the commands `\chapter',
  633. `\section', `\subsection', `\subsubsection', `\eqno', `\label', `\ref',
  634. `\cite', `\bibitem' and `\typeout' is a tag.
  635.  
  636. 
  637. File: emacs,  Node: Create Tag Table,  Next: Select Tag Table,  Prev: Tag Syntax,  Up: Tags
  638.  
  639. Creating Tag Tables
  640. -------------------
  641.  
  642.    The `etags' program is used to create a tag table file.  It knows
  643. the syntax of several languages, as described in *Note Tag Syntax::.
  644. Here is how to run `etags':
  645.  
  646.      etags INPUTFILES...
  647.  
  648. The `etags' program reads the specified files, and writes a tag table
  649. named `TAGS' in the current working directory.  `etags' recognizes the
  650. language used in an input file based on its file name and contents;
  651. there are no switches for specifying the language.  The `-t' switch
  652. tells `etags' to record typedefs in C code as tags.
  653.  
  654.    If the tag table data become outdated due to changes in the files
  655. described in the table, the way to update the tag table is the same way
  656. it was made in the first place.  It is not necessary to do this often.
  657.  
  658.    If the tag table fails to record a tag, or records it for the wrong
  659. file, then Emacs cannot possibly find its definition.  However, if the
  660. position recorded in the tag table becomes a little bit wrong (due to
  661. some editing in the file that the tag definition is in), the only
  662. consequence is a slight delay in finding the tag.  Even if the stored
  663. position is very wrong, Emacs will still find the tag, but it must
  664. search the entire file for it.
  665.  
  666.    So you should update a tag table when you define new tags that you
  667. want to have listed, or when you move tag definitions from one file to
  668. another, or when changes become substantial.  Normally there is no need
  669. to update the tag table after each edit, or even every day.
  670.  
  671. 
  672. File: emacs,  Node: Select Tag Table,  Next: Find Tag,  Prev: Create Tag Table,  Up: Tags
  673.  
  674. Selecting a Tag Table
  675. ---------------------
  676.  
  677.    Emacs has at any time one "selected" tag table, and all the commands
  678. for working with tag tables use the selected one.  To select a tag
  679. table, type `M-x visit-tags-table', which reads the tag table file name
  680. as an argument.  The name `TAGS' in the default directory is used as the
  681. default file name.
  682.  
  683.    All this command does is store the file name in the variable
  684. `tags-file-name'.  Emacs does not actually read in the tag table
  685. contents until you try to use them.  Setting this variable yourself is
  686. just as good as using `visit-tags-table'.  The variable's initial value
  687. is `nil'; that value tells all the commands for working with tag tables
  688. that they must ask for a tag table file name to use.
  689.  
  690.    Using `visit-tags-table' to load a new tag table does not discard
  691. the other tables previously loaded.  The other tags commands use all
  692. the tag tables that are loaded; the first one they use is the one that
  693. mentions the current visited file.
  694.  
  695.    You can specify a precise list of tag tables by setting the variable
  696. `tags-table-list' to a list of strings, like this:
  697.  
  698.      (setq tags-table-list
  699.            '("~/emacs" "/usr/local/lib/emacs/src"))
  700.  
  701. This tells the tags commands to look at the `TAGS' files in your
  702. `~/emacs' directory and in the `/usr/local/lib/emacs/src' directory.
  703. The order depends on which file you are in and which tags table
  704. mentions that file, as explained above.
  705.  
  706. 
  707. File: emacs,  Node: Find Tag,  Next: Tags Search,  Prev: Select Tag Table,  Up: Tags
  708.  
  709. Finding a Tag
  710. -------------
  711.  
  712.    The most important thing that a tag table enables you to do is to
  713. find the definition of a specific tag.
  714.  
  715. `M-. TAG RET'
  716.      Find first definition of TAG (`find-tag').
  717.  
  718. `C-u M-.'
  719.      Find next alternate definition of last tag specified.
  720.  
  721. `C-u - M-.'
  722.      Go back to previous tag found.
  723.  
  724. `M-x find-tag-regexp RET PATTERN RET'
  725.      Find a tag whose name matches PATTERN.
  726.  
  727. `C-u M-x find-tag-regexp'
  728.      Find the next tag whose name matches the last pattern used.
  729.  
  730. `C-x 4 . TAG RET'
  731.      Find first definition of TAG, but display it in another window
  732.      (`find-tag-other-window').
  733.  
  734. `C-x 5 . TAG RET'
  735.      Find first definition of TAG, and create a new frame to select the
  736.      buffer (`find-tag-other-frame').
  737.  
  738.    `M-.' (`find-tag') is the command to find the definition of a
  739. specified tag.  It searches through the tag table for that tag, as a
  740. string, and then uses the tag table info to determine the file that the
  741. definition is in and the approximate character position in the file of
  742. the definition.  Then `find-tag' visits that file, moves point to the
  743. approximate character position, and searches ever-increasing distances
  744. away to find the tag definition.
  745.  
  746.    If an empty argument is given (just type RET), the sexp in the
  747. buffer before or around point is used as the TAG argument.  *Note
  748. Lists::, for info on sexps.
  749.  
  750.    You don't need to give `M-.' the full name of the tag; a part will
  751. do.  This is because `M-.' finds tags in the table which contain TAG as
  752. a substring.  However, it prefers an exact match to a substring match.
  753.  
  754.    To find other tags that match the same substring, give `find-tag' a
  755. numeric argument, as in `C-u M-.'; this does not read a tag name, but
  756. continues searching the tag table's text for another tag containing the
  757. same substring last used.  If you have a real META key, `M-0 M-.' is an
  758. easier alternative to `C-u M-.'.
  759.  
  760.    Like most commands that can switch buffers, `find-tag' has a variant
  761. that displays the new buffer in another window, and one that makes a
  762. new frame for it.  The former is `C-x 4 .', which invokes the command
  763. `find-tag-other-window'.  The latter is `C-x 5 .', which invokes
  764. `find-tag-other-frame'.
  765.  
  766.    To move back to places you've found tags recently, use `C-u - M-.';
  767. more generally, `M-.' with a negative numeric argument.  This command
  768. can take you to another buffer.  `C-x 4 .' with a negative argument
  769. finds the previous tag location in another window.
  770.  
  771.    The new command `M-x find-tag-regexp' visits the tags that match a
  772. specified regular expression.  It is just like `M-.' except that it
  773. does regexp matching instead of substring matching.
  774.  
  775.    Emacs comes with a tag table file `src/TAGS' that includes all the
  776. Lisp libraries and all the C sources of Emacs.  By specifying this file
  777. with `visit-tags-table' and then using `M-.' you can quickly find the
  778. source for any Emacs function.
  779.  
  780. 
  781. File: emacs,  Node: Tags Search,  Next: Tags Stepping,  Prev: Find Tag,  Up: Tags
  782.  
  783. Searching and Replacing with Tag Tables
  784. ---------------------------------------
  785.  
  786.    The commands in this section visit and search all the files listed
  787. in the selected tag table, one by one.  For these commands, the tag
  788. table serves only to specify a sequence of files to search.  A related
  789. command is `M-x grep' (*note Compilation::.).
  790.  
  791. `M-x tags-search'
  792.      Search for the specified regexp through the files in the selected
  793.      tag table.
  794.  
  795. `M-x tags-query-replace'
  796.      Perform a `query-replace' on each file in the selected tag table.
  797.  
  798. `M-,'
  799.      Restart one of the commands above, from the current location of
  800.      point (`tags-loop-continue').
  801.  
  802.    `M-x tags-search' reads a regexp using the minibuffer, then searches
  803. for matches in all the files in the selected tag table, one file at a
  804. time.  It displays the name of the file being searched so you can
  805. follow its progress.  As soon as it finds an occurrence, `tags-search'
  806. returns.
  807.  
  808.    Having found one match, you probably want to find all the rest.  To
  809. find one more match, type `M-,' (`tags-loop-continue') to resume the
  810. `tags-search'.  This searches the rest of the current buffer, followed
  811. by the remaining files of the tag table.
  812.  
  813.    `M-x tags-query-replace' performs a single `query-replace' through
  814. all the files in the tag table.  It reads a regexp to search for and a
  815. string to replace with, just like ordinary `M-x query-replace-regexp'.
  816. It searches much like `M-x tags-search' but repeatedly, processing
  817. matches according to your input.  *Note Replace::, for more information
  818. on query replace.
  819.  
  820.    It is possible to get through all the files in the tag table with a
  821. single invocation of `M-x tags-query-replace'.  But since any
  822. unrecognized character causes the command to exit, you may need to
  823. continue where you left off.  `M-,' can be used for this.  It resumes
  824. the last tags search or replace command that you did.
  825.  
  826.    The commands in this section carry out much broader searches than the
  827. `find-tags' family.  The `find-tags' commands search only for
  828. definitions of tags that match your substring or regexp.  The commands
  829. `tags-search' and `tags-query-replace' find every occurrence of the
  830. regexp, as ordinary search commands and replace commands do in the
  831. current buffer.
  832.  
  833.    These commands create buffers only temporarily for the files that
  834. they have to search (those which are not already visited in Emacs
  835. buffers).  Buffers in which no match is found are quickly killed; the
  836. others continue to exist.
  837.  
  838.    It may have struck you that `tags-search' is a lot like `grep'.  You
  839. can also run `grep' itself as an inferior of Emacs and have Emacs show
  840. you the matching lines one by one.  This works mostly the same as
  841. running a compilation and having Emacs show you where the errors were.
  842. *Note Compilation::.
  843.  
  844. 
  845. File: emacs,  Node: Tags Stepping,  Next: List Tags,  Prev: Tags Search,  Up: Tags
  846.  
  847. Stepping Through a Tag Table
  848. ----------------------------
  849.  
  850.    If you wish to process all the files in the selected tag table, but
  851. not in the specific ways that `M-x tags-search' and `M-x
  852. tags-query-replace' do, you can use `M-x next-file' to visit the files
  853. one by one.
  854.  
  855. `C-u M-x next-file'
  856.      Visit the first file in the tag table, and prepare to advance
  857.      sequentially by files.
  858.  
  859. `M-x next-file'
  860.      Visit the next file in the selected tag table.
  861.  
  862. 
  863. File: emacs,  Node: List Tags,  Prev: Tags Stepping,  Up: Tags
  864.  
  865. Tag Table Inquiries
  866. -------------------
  867.  
  868. `M-x list-tags'
  869.      Display a list of the tags defined in a specific program file.
  870.  
  871. `M-x tags-apropos'
  872.      Display a list of all tags matching a specified regexp.
  873.  
  874.    `M-x list-tags' reads the name of one of the files described by the
  875. selected tag table, and displays a list of all the tags defined in that
  876. file.  The "file name" argument is really just a string to compare
  877. against the names recorded in the tag table; it is read as a string
  878. rather than as a file name.  Therefore, completion and defaulting are
  879. not available, and you must enter the string the same way it appears in
  880. the tag table.  Do not include a directory as part of the file name
  881. unless the file name recorded in the tag table includes a directory.
  882.  
  883.    `M-x tags-apropos' is like `apropos' for tags.  It reads a regexp,
  884. then finds all the tags in the selected tag table whose entries match
  885. that regexp, and displays the tag names found.
  886.  
  887.    You can also perform completion in the buffer on the name space of
  888. tag names in the current tag tables.  *Note Symbol Completion::.
  889.  
  890. 
  891. File: emacs,  Node: Emerge,  Next: C Mode,  Prev: Tags,  Up: Programs
  892.  
  893. Merging Files with Emerge
  894. =========================
  895.  
  896.    It's not unusual for programmers to get their signals crossed and
  897. modify the same program in two different directions.  To recover from
  898. this confusion, you need to merge the two versions.  Emerge makes this
  899. easier.  See also *Note Comparing Files::.
  900.  
  901. * Menu:
  902.  
  903. * Overview of Emerge::        How to start Emerge.  Basic concepts.
  904. * Submodes of Emerge::      Fast mode vs. Edit mode.
  905.                   Skip Prefers mode and Auto Advance mode.
  906. * State of Difference::        You do the merge by specifying state A or B
  907.                   for each difference.
  908. * Merge Commands::        Commands for selecting a difference,
  909.                   changing states of differences, etc.
  910. * Exiting Emerge::        What to do when you've finished the merge.
  911. * Combining in Emerge::        How to keep both alternatives for a difference.
  912. * Fine Points of Emerge::   Misc.
  913.  
  914. 
  915. File: emacs,  Node: Overview of Emerge,  Next: Submodes of Emerge,  Up: Emerge
  916.  
  917. Overview of Emerge
  918. ------------------
  919.  
  920.    To start Emerge, run one of these four commands:
  921.  
  922. `M-x emerge-files'
  923.      Merge two specified files.
  924.  
  925. `M-x emerge-files-with-ancestor'
  926.      Merge two specified files, with reference to a common ancestor.
  927.  
  928. `M-x emerge-buffers'
  929.      Merge two buffers.
  930.  
  931. `M-x emerge-buffers-with-ancestor'
  932.      Merge two buffers with reference to a common ancestor in a third
  933.      buffer.
  934.  
  935.    The Emerge commands compare two files or buffers, and display the
  936. comparison in three buffers: one for each input text (the "A buffer"
  937. and the "B buffer"), and one (the "merge buffer") where merging takes
  938. place.  The merge buffer shows the full merged text, not just the
  939. differences.  Wherever the two input texts differ, you can choose which
  940. one of them to include in the merge buffer.
  941.  
  942.    The Emerge commands that take input from existing buffers use only
  943. the accessible portions of those buffers, if they are narrowed (*note
  944. Narrowing::.).
  945.  
  946.    If a common ancestor version is available, from which the two texts
  947. to be merged were both derived, Emerge can use it to guess which
  948. alternative is right.  Wherever one current version agrees with the
  949. ancestor, Emerge presumes that the other current version is a deliberate
  950. change which should be kept in the merged version.  Use the
  951. `with-ancestor' commands if you want to specify a common ancestor text.
  952. These commands read three file or buffer names--variant A, variant B,
  953. and the common ancestor.
  954.  
  955.    After the comparison is done and the buffers are prepared, the
  956. interactive merging starts.  You control the merging by typing special
  957. commands in the merge buffer.  The merge buffer shows you a full merged
  958. text, not just differences.  For each run of differences between the
  959. input texts, you can choose which one of them to keep, or edit them both
  960. together.
  961.  
  962.    The merge buffer uses a special major mode, Emerge mode, with
  963. commands for making these choices.  But you can also edit the buffer
  964. with ordinary Emacs commands.
  965.  
  966.    At any given time, the attention of Emerge is focused on one
  967. particular difference, called the "selected" difference.  This
  968. difference is marked off in the three buffers like this:
  969.  
  970.      vvvvvvvvvvvvvvvvvvvv
  971.      TEXT THAT DIFFERS
  972.      ^^^^^^^^^^^^^^^^^^^^
  973.  
  974. Emerge numbers all the differences sequentially and the mode line
  975. always shows the number of the selected difference.
  976.  
  977.    Normally, the merge buffer starts out with the A version of the text.
  978. But when the A version of a part of the buffer agrees with the common
  979. ancestor, then the B version is preferred for that part.
  980.  
  981.    Emerge leaves the merged text in the merge buffer when you exit.  At
  982. that point, you can save it in a file with `C-x C-w'.  If you give a
  983. prefix argument to `emerge-files' or `emerge-files-with-ancestor', it
  984. reads the name of the output file using the minibuffer.  (This is the
  985. last file name those commands read.) Then exiting from Emerge saves the
  986. merged text in the output file.
  987.  
  988.    If you abort Emerge with `C-]', the output is not saved.
  989.  
  990. 
  991. File: emacs,  Node: Submodes of Emerge,  Next: State of Difference,  Prev: Overview of Emerge,  Up: Emerge
  992.  
  993. Submodes of Emerge
  994. ------------------
  995.  
  996.    You can choose between two modes for giving merge commands: Fast mode
  997. and Edit mode.  In Fast mode, basic Emerge commands are single
  998. characters, but ordinary Emacs commands are disabled.  This is
  999. convenient if you use only Emerge commands.
  1000.  
  1001.    In Edit mode, all Emerge commands start with the prefix key `C-c
  1002. C-c', and the normal Emacs commands are also available.  This allows
  1003. editing the merge buffer, but slows down Emerge operations.
  1004.  
  1005.    Use `e' to switch to Edit mode, and `C-c C-c f' to switch to Fast
  1006. mode.  The mode line indicates Edit and Fast modes with `E' and `F'.
  1007.  
  1008.    Emerge has two additional submodes that affect how particular merge
  1009. commands work: Auto Advance mode and Skip Prefers mode.
  1010.  
  1011.    If Auto Advance mode is in effect, the `a' and `b' commands advance
  1012. to the next difference.  This lets you go through the merge faster as
  1013. long as you simply choose one of the alternatives from the input.  The
  1014. mode line indicates Auto Advance mode with `A'.
  1015.  
  1016.    If Skip Prefers mode is in effect, the `n' and `p' commands skip
  1017. over differences in states prefer-A and prefer-B.  Thus you see only
  1018. differences for which neither version is presumed "correct".  The mode
  1019. line indicates Skip Prefers mode with `S'.
  1020.  
  1021.    Use the command `s a' (`emerge-auto-advance-mode') to set or clear
  1022. Auto Advance mode.  Use `s s' (`emerge-skip-prefers-mode') to set or
  1023. clear Skip Prefers mode.  These commands turn on the mode with a
  1024. positive argument, turns it off with a negative or zero argument, and
  1025. toggle the mode with no argument.
  1026.  
  1027. 
  1028. File: emacs,  Node: State of Difference,  Next: Merge Commands,  Prev: Submodes of Emerge,  Up: Emerge
  1029.  
  1030. State of a Difference
  1031. ---------------------
  1032.  
  1033.    In the merge buffer, a difference is marked with lines of `v' and
  1034. `^' characters.  Each difference has one of these seven states:
  1035.  
  1036. A
  1037.      The difference is showing the A version.  The `a' command always
  1038.      produces this state; the mode line indicates it with `A'.
  1039.  
  1040. B
  1041.      The difference is showing the B version.  The `b' command always
  1042.      produces this state; the mode line indicates it with `B'.
  1043.  
  1044. default-A
  1045. default-B
  1046.      The difference is showing the A or the B state by default, because
  1047.      you haven't made a choice.  All differences start in the default-A
  1048.      state (and thus the merge buffer is a copy of the A buffer),
  1049.      except those for which one alternative is "preferred" (see below).
  1050.  
  1051.      When you select a difference, its state changes from default-A or
  1052.      default-B to plain A or B.  Thus, the selected difference never has
  1053.      state default-A or default-B, and these states are never displayed
  1054.      in the mode line.
  1055.  
  1056.      The command `d a' chooses default-A as the default state, and `d
  1057.      b' chooses default-B.  This chosen default applies to all
  1058.      differences which you haven't selected and for which no
  1059.      alternative is preferred.  If you are moving through the merge
  1060.      sequentially, the differences you haven't selected are those
  1061.      following the selected one.  Thus, while moving sequentially, you
  1062.      can effectively make the A version the default for some sections
  1063.      of the merge buffer and the B version the default for others by
  1064.      using `d a' and `d b' at the end of each section.
  1065.  
  1066. prefer-A
  1067. prefer-B
  1068.      The difference is showing the A or B state because it is
  1069.      "preferred".  This means that you haven't made an explicit choice,
  1070.      but one alternative seems likely to be right because the other
  1071.      alternative agrees with the common ancestor.  Thus, where the A
  1072.      buffer agrees with the common ancestor, the B version is
  1073.      preferred, because chances are it is the one that was actually
  1074.      changed.
  1075.  
  1076.      These two states are displayed in the mode line as `A*' and `B*'.
  1077.  
  1078. combined
  1079.      The difference is showing a combination of the A and B states, as a
  1080.      result of the `x c' or `x C' commands.
  1081.  
  1082.      Once a difference is in this state, the `a' and `b' commands don't
  1083.      do anything to it unless you give them a prefix argument.
  1084.  
  1085.      The mode line displays this state as `comb'.
  1086.  
  1087. 
  1088. File: emacs,  Node: Merge Commands,  Next: Exiting Emerge,  Prev: State of Difference,  Up: Emerge
  1089.  
  1090. Merge Commands
  1091. --------------
  1092.  
  1093.    Here are the Merge commands for Fast mode; in Edit mode, precede them
  1094. with `C-c C-c':
  1095.  
  1096. `p'
  1097.      Select the previous difference.
  1098.  
  1099. `n'
  1100.      Select the next difference.
  1101.  
  1102. `a'
  1103.      Choose the A version of this difference.
  1104.  
  1105. `b'
  1106.      Choose the B version of this difference.
  1107.  
  1108. `j'
  1109.      Select a particular difference; specify the sequence number of that
  1110.      difference as a prefix argument.
  1111.  
  1112. `.'
  1113.      Select the difference containing point.  You can use this command
  1114.      in the merge buffer or in the A or B buffer.
  1115.  
  1116. `q'
  1117.      Quit--finish the merge.
  1118.  
  1119. `C-]'
  1120.      Abort--exit merging and do not save the output.
  1121.  
  1122. `f'
  1123.      Go into Fast mode.  (In Edit mode, this is actually `C-c C-c f'.)
  1124.  
  1125. `e'
  1126.      Go into Edit mode.
  1127.  
  1128. `l'
  1129.      Recenter (like `C-l') all three windows.
  1130.  
  1131. `-'
  1132.      Specify part of a prefix numeric argument.
  1133.  
  1134. `DIGIT'
  1135.      Also specify part of a prefix numeric argument.
  1136.  
  1137. `d a'
  1138.      Choose the A version as the default from here down in the merge
  1139.      buffer.
  1140.  
  1141. `d b'
  1142.      Choose the B version as the default from here down in the merge
  1143.      buffer.
  1144.  
  1145. `c a'
  1146.      Copy the A version of this difference into the kill ring.
  1147.  
  1148. `c b'
  1149.      Copy the B version of this difference into the kill ring.
  1150.  
  1151. `i a'
  1152.      Insert the A version of this difference at the point.
  1153.  
  1154. `i b'
  1155.      Insert the B version of this difference at the point.
  1156.  
  1157. `m'
  1158.      Put the point and mark around the difference region.
  1159.  
  1160. `^'
  1161.      Scroll all three windows down (like `M-v').
  1162.  
  1163. `v'
  1164.      Scroll all three windows up (like `C-v').
  1165.  
  1166. `<'
  1167.      Scroll all three windows left (like `C-x <').
  1168.  
  1169. `>'
  1170.      Scroll all three windows right (like `C-x >').
  1171.  
  1172. `|'
  1173.      Reset horizontal scroll on all three windows.
  1174.  
  1175. `x 1'
  1176.      Shrink the merge window to one line.  (Use `C-u l' to restore it
  1177.      to full size.)
  1178.  
  1179. `x c'
  1180.      Combine the two versions of this difference.
  1181.  
  1182. `x f'
  1183.      Show the files/buffers Emerge is operating on in Help window.
  1184.      (Use `C-u l' to restore windows.)
  1185.  
  1186. `x j'
  1187.      Join this difference with the following one.  (`C-u x j' joins
  1188.      this difference with the previous one.)
  1189.  
  1190. `x s'
  1191.      Split this difference into two differences.  Before you use this
  1192.      command, position point in each of the three buffers to the place
  1193.      where you want to split the difference.
  1194.  
  1195. `x t'
  1196.      Trim identical lines off top and bottom of the difference.  Such
  1197.      lines occur when the A and B versions are identical but differ
  1198.      from the ancestor version.
  1199.  
  1200. 
  1201. File: emacs,  Node: Exiting Emerge,  Next: Combining in Emerge,  Prev: Merge Commands,  Up: Emerge
  1202.  
  1203. Exiting Emerge
  1204. --------------
  1205.  
  1206.    The `q' command (`emerge-quit') finishes the merge, storing the
  1207. results into the output file if you specified one.  It restores the A
  1208. and B buffers to their proper contents, or kills them if they were
  1209. created by Emerge and you haven't changed them.  It also disables the
  1210. Emerge commands in the merge buffer, since executing them later could
  1211. damage the contents of the various buffers.
  1212.  
  1213.    `C-]' aborts the merge.  This means exiting without writing the
  1214. output file.  If you didn't specify an output file, then there is no
  1215. real difference between aborting and finishing the merge.
  1216.  
  1217.    If Emerge was called from another Lisp program, then its return value
  1218. is `t' for successful completion, or `nil' if you abort.
  1219.  
  1220.